//
//  PersonActivityTableViewCell.swift
//  XMYouPin
//
//  Created by 王宗成 on 2019/8/2.
//  Copyright © 2019 王宗成. All rights reserved.
//

import UIKit

class PersonActivityTableViewCell: WZC_TableViewCell {

    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        createUI()
        
    }
    
    func createUI() -> Void {
        
        for view in subviews {
            
            view.removeFromSuperview()
        }
    
        let width:CGFloat = kScreenW/4
        let titles:Array<String> = ["拼团","收藏","优惠券","新人邀请"]
        let icons:Array<String> = ["mjyp_set_icon_groupbuying","mjyp_set_icon_collection","mjyp_set_icon_discountcoupon","mjyp_set_icon_newuser"]
        let subTitles:Array<String> = ["","","","立享红包"]
        for i in 0..<4 {
            
            let itemView:PersonItemView = PersonItemView()
            addSubview(itemView)
          
            itemView.snp.makeConstraints { (make) in
                
                make.width.equalTo(width)
                make.top.equalTo(20)
                make.left.equalTo(CGFloat(i)*width)
              
            }
            itemView.titleLabel.text = titles[i]
            itemView.bgImgView.image = IMAGE(icons[i])
            itemView.subTitleLabel.text = subTitles[i]
            
        }
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
